home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 3.5 KB | 161 lines | [TEXT/MPS ] |
- /*
- File: EnclosFile.cp
-
- Contains: xxx put contents here xxx
-
- Written by: David AKhond
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <2> 2/27/95 TMH adapt to use ETO16 universal headers
-
- To Do:
- */
-
-
-
- #include "EnclosFile.h"
-
- #include <Memory.h>
-
- #ifndef __Debug__
- #include "Debug.h"
- #endif
-
- #ifndef __UFAILURE__
- #include "UFailure.h"
- #endif
-
- #ifndef __LogErrors__
- #include "LogErrors.h"
- #endif
-
- #pragma segment AOCEEnclosure
-
-
- //-------------------------------------------------
-
- CEnclosFileSummary::CEnclosFileSummary(unsigned long fileIndex, unsigned long /*fileSize*/, OSType fileType, OSType fileCreator, StringPtr fileName,
- unsigned long resourceForkOffset, unsigned long resourceForkLength, unsigned long dataForkOffset,
- unsigned long dataForkLength, unsigned short fdInfo, unsigned long fileCreationDate, unsigned long fileModificationDate)
- {
-
- unsigned char nameLength;
-
- fLink = 0;
-
- fFileIndex = fileIndex;
-
- fFileSize = resourceForkLength + dataForkLength;
-
- fType = fileType;
-
- fCreator = fileCreator;
-
- fResourceForkOffset = resourceForkOffset;
- fResourceForkLength = resourceForkLength;
- fDataForkOffset = dataForkOffset;
- fDataForkLength = dataForkLength;
-
- fFinderFlags = fdInfo;
-
- fFileCreationDate = fileCreationDate;
- fFileModificationDate = fileModificationDate;
-
- nameLength = (unsigned char)*fileName;
-
- BlockMove(fileName, &fRealName, nameLength+1);
-
- }
-
-
-
- //--------------------------------------------------------------------------------------------------------
-
- CEnclosFileSummaryList::CEnclosFileSummaryList()
- {
- fHeadSummary = 0;
- fTailSummary = 0;
- fCount = 0;
- }
-
-
- //---------------------------------------------------
- CEnclosFileSummaryList::~CEnclosFileSummaryList()
- {
-
- CEnclosFileSummary* aSummary = fHeadSummary;
- CEnclosFileSummary* nextSummary = 0;
-
-
- // Delete all the objects in the list.
-
-
- while( aSummary != 0 ) {
- nextSummary = aSummary->fLink;
- delete aSummary;
- aSummary = nextSummary;
- }
-
-
- }
-
-
- //-------------------------------------------------------------------
- void CEnclosFileSummaryList::Append(unsigned long fileIndex, unsigned long fileSize, OSType fileType, OSType fileCreator, StringPtr fileName,
- unsigned long resourceForkOffset, unsigned long resourceForkLength, unsigned long dataForkOffset,
- unsigned long dataForkLength, unsigned short fdInfo, unsigned long fileCreationDate, unsigned long fileModificationDate)
- {
- CEnclosFileSummary* msgSummary = new CEnclosFileSummary(fileIndex, fileSize, fileType, fileCreator, fileName, resourceForkOffset, resourceForkLength, dataForkOffset, dataForkLength, fdInfo, fileCreationDate, fileModificationDate);
- this->Append(msgSummary);
-
- }
-
-
- //-------------------------------------------------------------------
- void CEnclosFileSummaryList::Append(CEnclosFileSummary* summary)
- {
- if( fHeadSummary == 0 ) {
-
- ASSERT(fTailSummary==0);
- fHeadSummary = summary;
- fTailSummary = summary;
- summary->fLink = 0;
-
- } else {
-
- ASSERT(fHeadSummary!=0);
- ASSERT(fTailSummary!=0);
- ASSERT(fTailSummary->fLink==0);
- fTailSummary->fLink = summary;
- fTailSummary = summary;
- summary->fLink = 0;
- };
-
- fCount++;
- }
-
-
- //-------------------------------------------------------------------
- CEnclosFileSummary* CEnclosFileSummaryList::operator [](long i)
- {
- ASSERT(i<=fCount);
-
- CEnclosFileSummary* aSummary = fHeadSummary;
- while( (aSummary != 0) && (i > 0) ) {
- aSummary = aSummary->fLink;
- i--;
- };
-
-
- return aSummary;
-
- }
-
-
-
-
-
-